/*
 * MutationStrategy.h
 *
 *  Created on: Oct 21, 2013
 *      Author: filipe
 */

#ifndef MUTATIONSTRATEGY_H_
#define MUTATIONSTRATEGY_H_

#include <time.h>
#include <cstdlib>

namespace EvolutionaryOptimization
{
	template<class T>
	class MutationStrategy
	{
		protected:

			int _Dimension;

			virtual void _ApplyMutation(T *individual, int gene) const = 0;

		public:

			MutationStrategy(int dimension)
			{
				_Dimension = dimension;
				srand(time(NULL));
			}

			virtual ~MutationStrategy()
			{
			}

			virtual void PerformMutation(T *individual) const
			{
				int gene = rand() % _Dimension;
				_ApplyMutation(individual, gene);
			}
	};
}

#endif
